package com.shoesmail.enums;

public enum RoleEnum {
    USER(0,"普通用户"),
    ADMIN(1,"普通管理员"),
    SUPER_ADMIN(2,"超级管理员");

    int code;
    String desc;

    public int getCode(){
        return this.code;
    }

    public static RoleEnum getRole(int code){
        if(code==0){
            return RoleEnum.USER;
        }else if(code==1){
            return RoleEnum.ADMIN;
        }else if(code==2){
            return RoleEnum.SUPER_ADMIN;
        }
        return null;
    }

    RoleEnum(int code,String desc){
        this.code = code;
        this.desc = desc;
    }


    public boolean equals(RoleEnum role){
        if(role==null) return false;
        return role.getCode()==this.getCode();
    }
}
